<template>
  <div class="number_container">
    <div class="number">
      <div class="box" v-for="item in orderList" :key="item.id">
        <div class="img">
          <img src="../../../../assets/image/home/number.png" alt="">
        </div>
        <div class="order_number">
          <div style="font-size: 20px;margin-bottom: 5px;">{{ item.number }}</div>
          <div style="font-size: 14px;">今日订单量</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts" name="numberList">
import { getOrderDataAPI } from '@/api/home'
import { ref, reactive, onMounted } from 'vue'
// 获取时间
let date = new Date()
const dates = date.getFullYear() + (date.getMonth() + 1) + date.getDate()
// 订单量数据
// type order = {
//   code: number,
//   msg: string,
//   data: object,
//   id: number,
//   number: number
// }
const orderList: any = ref([])
// 调取订单接口
const getOrderData = async () => {
  const res: any = await getOrderDataAPI(String(dates))
  if (res.code == 200) {
    orderList.value = res.data
  }
}

onMounted(() => {
  getOrderData()
})
</script>

<style scoped lang="less">
.number_container {
  .number {
    width: 100%;
    height: 160px;
    display: flex;
    flex-wrap: wrap;

    .box {
      position: relative;
      width: 32%;
      height: 60px;
      background: #fff;
      box-shadow: 3px 3px 7px;
      border-radius: 5px;

      .img {
        img {
          width: 60px;
          height: 60px;
          border-radius: 5px;
        }
      }

      .order_number {
        position: absolute;
        left: 70px;
        top: 7px;
      }
    }

    .box:nth-child(2),
    .box:nth-child(5) {
      margin: 0px 21.5px;
    }
  }
}
</style>
